﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 渐变.user_Form
{
    public partial class user_MyInformation : Form
    {
        public user_MyInformation()
        {
            InitializeComponent();
        }
        public string opname { get; set; }
        public string ophone { get; set; }
        public string oaddress { get; set; }
        public string opassword { get; set; }
    
        private void user_MyInformation_Load(object sender, EventArgs e)
        {
            this.Dock = DockStyle.Fill;
            //根据姓名查询所剩余额
            string sql = "select umoney from uUser where uUsername=@uUsername";
            SqlParameter p = new SqlParameter("@uUsername", this.opname);
            DataTable dt = new DataTable();
            dt = DBHelper.ExecuteQuery(sql, p);
            txtBalance.Text = dt.Rows[0][0].ToString();
            txtName.Text = this.opname;
            txtPhone.Text = this.ophone;
            txtAddess.Text = this.oaddress;
        }

        private void btnEdit_Click(object sender, EventArgs e)
        {
            user_editInformation editInformation = new user_editInformation();
            editInformation.epname = this.opname;
            editInformation.epassword = this.opassword;
            editInformation.eaddress = this.oaddress;
            editInformation.ephone = this.ophone;

            DialogResult dr = editInformation.ShowDialog();
            if (dr == DialogResult.OK)
            {
                user_MyInformation_Load(null, null);
            }
        }
    }
}
